#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.maple import *

# variáveis úteis
half = M('1/2')
t = M.t
_i, _j, _k = M('_i, _j, _k')
rr = M('`..`')
coeff = M.coeff

n_iter = 0
while True:
    with display_block('Entradas'):
        a = M(oneof(-2, -1, -1, 1, 1, 2, 3))
        b = M(oneof(-2, -1, 1, 1, 2, 3))
        c = M(oneof(-2, -1, 1, 1, 2, 3))
        d = M(oneof(-2, -1, 1, 1, 2, 3))

        F = fieldF = (-a * y) * _i + \
                     (a * x + b * z) * _j + \
                     (c * (cos(x) ** 2 + sin(y) ** 2) + d * z) * _k

    with display_block('Resultados'):
        n_iter += 1
        fluxo = 2 * Pi * a
        gauss = Pi * d / 2
        intarea = 2 * Pi * (b + 2 * a)
        rot = 4 * Pi * a
        distr1 = oneof(fluxo, gauss, intarea, rot) * oneof(-2, -1, 1, 2, 4) / M(oneof(-2, -1, 1, 2, 4))
        distr2 = oneof(fluxo, gauss, intarea, rot) * oneof(-2, -1, 1, 2, 4) / M(oneof(-2, -1, 1, 2, 4))

    if len(set([fluxo, gauss, intarea, rot, distr1, distr2])) == 6:
        break
